﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutPageVue.cshtml";
}
@this.Partial("Index-js")
@this.RefStyle("~/Content/wdtree/tree.css")
@this.RefScript("~/Content/wdtree/tree.js")
@this.RefStyle("~/Content/select2/select2.min.css")
@this.RefScript("~/Content/select2/select2.min.js")
@this.RefStyle("~/Content/wizard/wizard.css")
@this.RefScript("~/Content/wizard/wizard.js")

<div id="app" class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$hits.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" v-bind:disabled="Disabled()" v-on:click="Edit"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" v-bind:disabled="Disabled()" v-on:click="Delete"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" v-on:click="Add"><i class="fa fa-plus"></i>添加</button>
        </div>

    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="类别名称/类别编号" style="width: 400px;" v-model="SearchModel.keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" v-on:click="Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div id="table" class="table-responsive" v-cloak>
    <table class="table table-hover">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>类别名称</th>
                <th>类别编号</th>
                <th>创建时间</th>
                <th>备注</th>
                <th>状态</th>
            </tr>
        </thead>

        <tbody>
            <tr v-for="(item,index) in Models" :class="{'warning':SelectedModel == item}" v-on:click="SelectRow(item)">
                <td>{{ GetOrdinal(index) }}</td>
                <td>{{ item.Name }}</td>
                <td>{{ item.EnCode }}</td>
                <td>{{ DateString(item.CreationTime) }}</td>
                <td>{{ item.Description }}</td>
                <td><span :class="{'badge badge-primary':item.IsEnabled,'badge badge-danger':!item.IsEnabled}">{{ GetEnable(item.IsEnabled) }}</span></td>
            </tr>
        </tbody>
        @this.Partial("_tfootVue")
    </table>


</div>
@this.Partial("_Modal")
<modal id="frmEdit" v-show="IsShow" v-on:close="IsShow = false" v-on:save="Save" v-cloak>
    <div slot="header">
        <h3>{{ Title }}</h3>
    </div>
    <div slot="body" class="modal-body">
        <form id="form1">
            <div class="widget-body">
                <div id="wizard" class="wizard" data-target="#wizard-steps" style="border-left: none; border-top: none; border-right: none;">
                    <ul class="steps">
                        <li data-target="#step-1" class="active"><span class="step">1</span>角色信息<span class="chevron"></span></li>
                        <li data-target="#step-2"><span class="step">2</span>功能权限<span class="chevron"></span></li>
                    </ul>
                </div>
                <div class="step-content" id="wizard-steps" style="border-left: none; border-bottom: none; border-right: none;">
                    <div class="step-pane active" id="step-1" style="margin: 10px; margin-bottom: 0px;">
                        @*<div class="alert alert-danger" style="text-align: left; margin-bottom: 10px;">
                                <i class="fa fa-warning alert-dismissible" style="position: relative; top: 1px; font-size: 15px; padding-right: 5px;"></i>
                                请填写角色信息，用于创建或修改角色信息！
                            </div>
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h3 class="panel-title">表单信息</h3>
                                </div>
                                <div class="panel-body" style="width: 98%;">*@
                        <table class="form">
                            <tr>
                                <th class="formTitle">类别名称</th>
                                <td class="formValue">
                                    <input id="FullName" name="Name" type="text" class="form-control required" placeholder="请输入类别名称" v-model="Model.Name" />
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">类别编号</th>
                                <td class="formValue">
                                    <input id="EnCode" name="EnCode" type="text" class="form-control required" placeholder="请输入类别编号" v-model="Model.EnCode" />
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle">显示顺序</th>
                                <td class="formValue">
                                    <input id="SortCode" name="SortCode" type="text" class="form-control" placeholder="请输入显示顺序" v-model="Model.SortCode" />
                                </td>
                            </tr>
                            <tr>
                                <td class="formTitle" style="height: 35px;">选项</td>
                                <td class="formValue" style="padding-top: 1px;">
                                    <div class="ckbox">
                                        <input id="IsEnabled" name="IsEnabled" type="checkbox" v-model="Model.IsEnabled"><label for="IsEnabled">是否启动</label>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <th class="formTitle" valign="top" style="padding-top: 5px;">
                                    备注
                                </th>
                                <td class="formValue">
                                    <textarea id="Description" name="Description" class="form-control" style="height: 60px;" v-model="Model.Description"></textarea>
                                </td>
                            </tr>
                        </table>
                        @*</div>
                            </div>*@
                    </div>
                    <div class="step-pane" id="step-2">
                        <div id="permissionTree"></div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div id="wizard-actions" slot="footer" class="modal-footer">
        <a id="btn_last" disabled class="btn btn-default btn-prev">上一步</a>
        <a id="btn_next" class="btn btn-default btn-next">下一步</a>
        <a id="btn_finish" class="btn btn-default" style="display: none;" v-on:click="Save">完成</a>
    </div>
</modal>